package com.itheima.springbootwebbtalis.mapper;

import com.github.pagehelper.Page;
import com.itheima.springbootwebbtalis.pojo.Clazz;
import com.itheima.springbootwebbtalis.pojo.ClazzQueryParam;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClazzMapper {
   // @Insert("insert into clazz(id,name,room,begin_date,end_date,master_id,subject,create_time,update_time) values(null,#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
    void clazzMapperAdd(Clazz clazz);
    @Select("select * from clazz;")
    List<Clazz> clazzMapperShowAll();

    // 根据id来查询
    @Select("select * from clazz where id = #{id};")
    Clazz clazzMapperShowById(Integer id);
    // 删除方式是：通过id来删除
     @Delete("delete from clazz where id = #{id};")
    void clazzMapperDeteleById(Integer id);
     @Update("update clazz set name = #{name},room = #{room},begin_date =#{beginDate},end_date =#{endDate},master_id=#{masterId},subject=#{subject}  where id =#{id};")
     void clazzMapperUpdate(Clazz clazz);
 // 分页查询

    Page<Clazz> selectByPage(ClazzQueryParam param);
}
